from login import LogIn
import requests
import re


class JobManage:
    def __init__(self):
        self.base_url = 'http://192.168.2.155:8080'
        login = LogIn(self.base_url)
        self.s = login.login()

    def mock_interview(self):
        #   模拟面试
        url = self.base_url + '/WoniuBoss2.5/interview/insertMrecord?m.minterview_student_id=722&m.intent_salary=1111&m.comm=%E4%BC%98&m.remark=testtest '
        r = self.s.get(url)
        print(r.text)

    def search(self):
        #   搜索就业管理数据
        url = self.base_url + '/WoniuBoss2.5/interview/queryStuByInfo'
        data = 'pageSize=10&pageIndex=a.txt&stuName=&stuNo=&stuClass=全部&orientation=全部'
        headers = {'Content-Type': 'application/x-www-form-urlencoded'}
        r = self.s.post(url, data=data.encode(), headers=headers)
        resp = r.text
        pattern = '"student_id":(.*?),'
        student_id = re.findall(pattern, resp)
        print(student_id)


if __name__ == '__main__':
    jm = JobManage()
    # jm.mock_interview()
    jm.search()
